<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>首页</title>
    <link rel="stylesheet" href="../../css/api.css">
    <link rel="stylesheet" href="../../css/main.css">
    <link rel="stylesheet" href="../../css/vant.css">

</head>

<body>
    <div class="app" v-cloak>
        <div class="header-common f7-header">
            <div class="flex-x-s header ">
                <span class="iconfont goback" @click="back">&#xe66f;</span>
                <div class="title">
                    <!-- {{detailItem.title}} -->
                </div>
                <div class="flex-x-s">
                    <div class="header-icon" @click="showDialog(1)">
                        <img src="https://zzzzkj.oss-cn-shanghai.aliyuncs.com/static/tiexie/app/image/image/mine/report.png" alt="">
                    </div>
                    <div class="header-icon" @click="showDialog(2)">
                        <img src="https://zzzzkj.oss-cn-shanghai.aliyuncs.com/static/tiexie/app/image/image/mine/share.png" alt="">
                    </div>
                </div>
            </div>
            <div class="f7-line"></div>
        </div>
        <van-goods-action class="foot">
            <van-goods-action-icon :color="isCollect?'#F53B31':'#408CEC'" :icon="isCollect?'star':'star-o'" text="收藏" @click="doCollect"></van-goods-action-icon>
            <div class="foot-btn">
                <van-button class="foot-call" style="width: 3.02rem;" round type="info"  @click="sendEvent('call')">立即联系</van-button>
            </div>
        </van-goods-action>
    </div>
    <script src="../../script/api.js"></script>
    <script src="../../script/flexible.js"></script>
    <script src="../../script/fastclick.js"></script>
    <script src="../../script/vue.min.js"></script>
    <script src="../../script/iconfont.js"></script>
    <script src="../../script/vant.min.js"></script>
    <script src="../../script/restful.js"></script>
    <script src="../../script/common.js"></script>
    <script src="../../script/businessCommon.js"></script>
    <script>
        apiready = function() {
            vm = new Vue({
                el: '.app',
                data() {
                    return {
                        detailItem: {},
                        isCollect:false,
                        module:'',
                        title: api.pageParam.title
                    }
                },
                mounted: function() {
                    console.log(JSON.stringify(api.pageParam));
                    this.init()
                    this.openFrame()
                },
                methods: {
                    init(){
                        var vm = this
                        // 初始化 收藏
                        vm.module = api.pageParam.title
                        vm.detailItem = api.pageParam.detailItem
                        checkHasCollect(vm.module, vm.detailItem.id, vm)
                        // 添加浏览
                        addBrowse(vm.module, vm.detailItem.id)
                    },
                    doCollect(){
                        handleCollect(vm.module, vm.detailItem.id ,vm)
                    },
                    openFrame(){
                        api.openFrame({
                            name: 'ask_rent_frm',
                            url: 'ask_rent_frm.html',
                            rect: {
                                marginTop: $api.fixStatusBar($api.dom('.header-common'))+2,
                                marginBottom: $api.fixTabBar($api.dom(".foot")),
                                w: 'auto'
                            },
                            pageParam: api.pageParam
                        });
                    },
                    back() {
                        api.closeWin();
                    },
                    sendEvent(){
                        if (!checkToken()) return false;
                        api.sendEvent({
                            name: 'sendRentDetail',
                            extra: {key:' value'}
                        });
                    },
                    showDialog(type) {
                        if(!checkToken()) return false;
                        toReportOrShareDialog(vm.module, vm.detailItem.id, type, vm.detailItem.title)
                    },
                },
            })
        }
    </script>
</body>

</html>